// search模块
import {getSearchList} from "@/api/index";
const state = {
    searchList: {}
};
const mutations = {
    GET_SEARCH_LIST(state, value) {
        state.searchList = value;
    }
};
const actions = {
    async getSearchList(context, params) {
        let response = await getSearchList(params);
        if (response.code === 200) {
            context.commit("GET_SEARCH_LIST", response.data);
        }
    }
};
// getters为了简化仓库数据而生
const getters = {
    goodsList(state) { // state=当前仓库的searchList
        return state.searchList.goodsList || [];
    },
    attrsList(state) {
        return state.searchList.attrsList;
    },
    trademarkList(state) {
        return state.searchList.trademarkList;
    }
};
export default {
    state,
    mutations,
    actions,
    getters
}